-- Viral Resistance - T-Engine 4 Module
-- Copyright (C) 2010 Mikolai Fajer
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program.  If not, see <http://www.gnu.org/licenses/>.
--
-- Mikolai Fajer "yufra"
-- mfajer@gmail.com

local Talents = require("engine.interface.ActorTalents")

newEntity{
	define_as = "BASE_NPC_ZOMBIE",
	type = "zombie", subtype = "humanoid",
	display = "z", color=colors.WHITE,
	desc = [[The froth at the mouth is the first sign... BRAINS!!!]],

	ai = "dumb_talented_simple_wander", ai_state = { talent_in=3, },
	stats = { str=5, dex=5, con=5 },
	vload = resolvers.rngavg(100, 125),
	max_vload = 200,
	combat_armor = 0,
	combat = {
		dam=0,
		vdam=1,
		dammod={
			str=0.7,
		},
	},
	can_climb = true,
	can_open_door = true,
	max_life = resolvers.rngavg(100, 120),
	faction = "infected",
	corpse = { name="Corpse of a zombie", display="&", color=colors.GREEN,
		type="corpse", subtype="zombie",
		desc=[[The body of a mutated human lies here.]],
		encumber=150,
	},
}

newEntity{ base = "BASE_NPC_ZOMBIE",
	name = "recent zombie", define_as = "ZOMBIE",
	desc = [[If it weren't for the frothy mouth this person looks completely normal.]],
	image = "npcs/zombie.png",
	level_range = {1, 4}, exp_worth = 1,
	rarity = 4,
	combat = { dam=2, vdam=1 },
	mutation = "MATURE",
}

newEntity{ base = "BASE_NPC_ZOMBIE",
	name = "mature zombie", define_as = "MATURE",
	color=colors.GREEN,
	desc = [[The tattered clothes and green tinged skin indicate the virus has matured in this individual.]],
	level_range = {6, 10}, exp_worth = 1,
	rarity = 4,
	max_life = resolvers.rngavg(140, 160),
	combat = { dam=2, vdam=2 },
	combat_armor = 3,
	mutation = {
		LEAPER=2,
		SPITTER=2,
		BOMBER=1,
	},
}

newEntity{ base = "BASE_NPC_ZOMBIE",
	name = "leaper", define_as = 'LEAPER',
	color=colors.PURPLE,
	desc = [[This zombie has massive legs and hops forward instead of the typical zombie lurch.]], 
	level_range = {6, 10}, exp_worth = 1,
	rarity = 4,
	combat = { dam=2, vdam=1},
	resolvers.talents{ [Talents.T_TACKLE]=1 },
    talent_cd_reduction = { [Talents.T_TACKLE]=15 },
}

newEntity{ base = "BASE_NPC_ZOMBIE",
	name = "spitter", define_as = 'SPITTER',
	color = colors.GREEN,
	image = "npcs/zombie_spitter.png",
	desc = [[The neck of this zombie is swollen, almost like a bullfrogs.]],
	level_range = {6, 10}, exp_worth = 1,
	rarity = 4,
	combat = { dam=1, vdam=2},
	resolvers.talents{ [Talents.T_SPIT]=1 },
}

newEntity{ base = "BASE_NPC_ZOMBIE",
	name = "bomber", define_as = 'BOMBER',
	color = colors.RED,
	image = "npcs/zombie_bomber.png",
	desc = [[Burst blood vessels have turned this zombies skin a reddish color, and his body grossly bloated.]],
	level_range = {6, 10}, exp_worth = 1,
	rarity = 4,
	max_life = resolvers.rngavg(60, 80),
	ai_state = { talent_in=1, },
	resolvers.talents{ [Talents.T_EXPLODE]=1 },
	on_die = function(self, who)
		-- Small gas explosion if killed
		if who ~= self then
			game.level.map:addEffect(self, self.x, self.y, 5,
				DamageType.VIRAL, rng.range(1,10), 0, 5, nil,
				{type="vapour"}, nil, false)
		else
			self.corpse = nil
		end
	end,
}